// var QQMapWX = require('../libs/qqmap-wx-jssdk'); //地图jdk
// var qqmapsdk;
// qqmapsdk = new QQMapWX({
//   key: 'YXSBZ-JZ3WG-5PEQV-IVDYA-BN5IF-Q5FK3'
// });

var qrcode= require('./brcode.js');
var barcode=require('./brcode.js');

// 插件内部是根据width, height参数的rpx值来进行绘画
// 把数字转换成条形码
function toBarcode(canvasId, code, width, height) {
  barcode.code128(wx.createCanvasContext(canvasId), code, width, height);
}

// // 把数字转换成二维码
// function toQrcode(canvasId, code, width, height) {
//   qrcode.api.draw(code, {
//     ctx: wx.createCanvasContext(canvasId),
//     width,
//     height
//   })
// }


const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()
  return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}



const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}

const getImageInfo = function() {

}


module.exports = {
  formatTime: formatTime,
 
  toBarcode,
}